# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=crosslinked
pkgver=49.2ae8d7b
pkgrel=4
epoch=1
pkgdesc='LinkedIn enumeration tool to extract valid employee names from an organization through search engine scraping.'
groups=('blackarch' 'blackarch-social' 'blackarch-recon')
arch=('any')
url='https://github.com/m8r0wn/crosslinked'
license=('GPL3')
depends=('python' 'python-argparse' 'python-beautifulsoup4' 'python-urllib3'
         'python-requests' 'python-unidecode' 'python-taser')
makedepends=('git')
source=("git+https://github.com/m8r0wn/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd "/usr/share/$pkgname/"
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname-pwd-gen" << EOF
#!/bin/sh
exec python "/usr/share/$pkgname/pwd_gen.py" "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname-pwd-gen"

  cat > "$pkgdir/usr/bin/$pkgname-user-gen" << EOF
#!/bin/sh
exec python "/usr/share/$pkgname/user_gen.py" "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname-user-gen"
}

